import React, {useContext} from 'react';
import One from "./One";
import context from "../context";
function Child() {
    const {state,setState} = useContext(context);
    return (
        <div>
            <h3>Child</h3>
            <p onClick={()=>setState({
                ...state,
                userName:state.userName+"!"
            })}>userName:{state.userName}</p>
            <p onClick={()=>setState({
                ...state,
                age:state.age+1
            })}>age:{state.age}</p>
            <hr/>

            <One/>
        </div>
    );
}

export default Child;